<?php
class Default_Form_Category extends Zend_Form
{

    public function init()
    {
        $this->setName("category");
        $categoryId = new Zend_Form_Element_Hidden('categoryId');
        $categoryId->addFilter('Int');
        
        $categoryName = new Zend_Form_Element_Text('categoryName');
        $categoryName->setLabel('Tên nhóm')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $categoryName->setAttrib('size', 60);
        
        $categoryCode = new Zend_Form_Element_Text('categoryCode');
        $categoryCode->setLabel('Mã nhóm')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
        $categoryCode->setAttrib('size', 60);
        
        $note = new Zend_Form_Element_Textarea('note');
        $note->setLabel('Ghi chú')->addFilter('StripTags')->addFilter('StringTrim');
        $note->setAttrib('cols', 70)->setAttrib('rows', 4);
        
        // submit button
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setAttrib('id','submitbutton');
        $submit->setAttrib('class',"button medium");
        // add elements to form
        $hash = new Zend_Form_Element_Hash('no_csrf_foo');
        $this->addElement('hash','no_csrf_foo',array (
            'salt' => 'T1EJtbLm40sRWNsj'
        ));
        $this->addElements(array ($categoryId, $categoryName, $categoryCode, $note, $submit));
    }
}

